<template>
    <div>
        <div class="zuo" style="float: left;">
            <van-sidebar v-model="active">
                <van-sidebar-item v-for="i in fldata" :title="i.cat_name" />
            </van-sidebar>
        </div>
        <div class="you">
            <div v-for="item in fldata[active]?.children">
                <h4>{{ item.cat_name }}</h4>
                <div >
                    <van-grid :border="false" :column-num="4">
                        <van-grid-item v-for="tu in item.children">
                            <van-grid-item :icon="tu.cat_icon"  :text="tu.cat_name" @click="tiao(tu.cat_id)"/>
                        </van-grid-item>
                    </van-grid>
                </div>
            </div>
        </div>
    </div>


</template>

<script setup>
import { ref } from 'vue';
const active = ref(0);
import { fl } from '@/api/api';
import router from '@/router';
let fldata = ref([])
fl().then(res => {
    console.log('分类', res)
    fldata.value = res.data.message
})

let tiao=(id)=>{
    router.push({
        path:'/erji/'+id
    })
}
</script>

<style lang="scss" scoped></style>